Lecture 35
Auburn University
MATH 2660 - Spring 2026
April 13, 2026
$$ % Colors
% Coordinate vectors and matrices
% Common sets
% Abstract vector symbols
% Norms / absolute value
% Optional: dot product spacing (looks nicer in slides)
% Operators $$
peppers.pngcameraman.tifsaturn.pngscripts/image_processing_demo.m.size(I) tells you the dimensions.m x n x 3.m x n.G for Fourier and SVD.theta = 30; % degrees
I_rot = imrotate(I, theta, "bilinear", "crop");
I_big = imresize(I, 1.3);
I_wide = imresize(I, [size(I,1), round(1.4 * size(I,2))]);
figure;
subplot(2,2,1); imshow(I); title("Original");
subplot(2,2,2); imshow(I_rot); title("Rotated");
subplot(2,2,3); imshow(I_big); title("Scaled up");
subplot(2,2,4); imshow(I_wide); title("Stretched horizontally");[m,n,channels] = size(I);
cx = (n + 1)/2;
cy = (m + 1)/2;
A = [1.15 0.35;
0.00 0.85]; % stretch + shear
Ainv = inv(A);
J = zeros(size(I));
for row_new = 1:m
for col_new = 1:n
q = [col_new - cx;
row_new - cy];
p = Ainv * q;
col_old = round(p(1) + cx);
row_old = round(p(2) + cy);
if 1 <= row_old && row_old <= m && 1 <= col_old && col_old <= n
for c = 1:channels
J(row_new, col_new, c) = I(row_old, col_old, c);
end
end
end
end
figure;
subplot(1,2,1); imshow(I); title("Original");
subplot(1,2,2); imshow(J); title("Applied matrix A");Ainv?round(...), so each new pixel copies the nearest old pixel.cx, cy: move the origin to the center of the imageq: one output pixel written as a centered coordinate vectorp = Ainv*q: trace that output point back to the source imageround(...): choose the nearest source pixelJ(row_new, col_new, :) = I(row_old, col_old, :): copy the colorfft2 is doingfft2 does for images what Fourier series do for 1D signals.abs(F) measures the strength of each frequency.angle(F) measures the phase.fftshift(...), the center of the picture corresponds to low frequencies.log(1 + abs(F)) because the raw coefficients can vary a lot in size.[m,n] = size(G);
[u,v] = meshgrid(-floor(n/2):ceil(n/2)-1, -floor(m/2):ceil(m/2)-1);
R = sqrt(u.^2 + v.^2);
D0 = 40; % cutoff radius
Hlow = double(R <= D0);
Flow = F .* Hlow;
Glow = real(ifft2(ifftshift(Flow)));
figure;
subplot(1,3,1); imshow(G, []); title("Original");
subplot(1,3,2); imshow(Hlow, []); title("Low-pass mask");
subplot(1,3,3); imshow(Glow, []); title("Low-pass result");R = I(:,:,1); Gch = I(:,:,2); B = I(:,:,3);
r = 40;
[Ur,Sr,Vr] = svd(R, "econ");
[Ug,Sg,Vg] = svd(Gch, "econ");
[Ub,Sb,Vb] = svd(B, "econ");
Rr = Ur(:,1:r) * Sr(1:r,1:r) * Vr(:,1:r)';
Gr = Ug(:,1:r) * Sg(1:r,1:r) * Vg(:,1:r)';
Br = Ub(:,1:r) * Sb(1:r,1:r) * Vb(:,1:r)';
I_svd = cat(3, Rr, Gr, Br);
figure;
subplot(1,2,1); imshow(I); title("Original");
subplot(1,2,2); imshow(I_svd); title("Color SVD approximation");